/*
  =====================================================================================
 *
 *       Filename:  Complex.h
 *
 *    Description:  Header of the Complex class
 *
 *        Version:  1.0
 *        Created:  11/24/11 21:03:12
 *       Revision:  none
 *       Compiler:  g++
 *
 *         Author:  LittleQ Su (), 98703060@nccu.edu.tw
 *        Company:  National Chengchi University, The Department of Computer Science
 *
 * =====================================================================================
 */
#ifndef _COMPLEX_H_
#define _COMPLEX_H_

#include "headers.h"
using namespace std;

class Complex {
    public:
        // Constructors
        Complex();
        Complex(const Complex &other);
        Complex(double other);
        Complex(double real, double fake);
        // Public methods
        void set(double real, double fake);
        double getReal() const;
        double getImag() const;
        string toString() const;
        float absolute() const;
        Complex conjugate() const;
        // Operator overloading
        const Complex operator+(const Complex &other) const;
        const Complex operator-(const Complex &other) const;
        const Complex operator*(const Complex &other) const;
        const Complex operator*(const double other) const;
        const Complex operator/(const Complex &other) const;
        const Complex operator/(const double other) const;

        Complex& operator+=(const Complex &rhs);
        Complex& operator-=(const Complex &rhs);
        Complex& operator*=(const Complex &rhs);
        Complex& operator/=(const Complex &rhs);
        Complex& operator=(const Complex &rhs);

        Complex& operator++();
        Complex& operator--();
        Complex& operator++(int idx);
        Complex& operator--(int idx);

        bool operator==(const Complex &other) const;
        bool operator==(const double other) const;
        bool operator!=(const Complex &other) const;
        bool operator!=(const double other) const;
        bool operator>=(const Complex &other) const;
        bool operator>=(const double other) const;
        bool operator>(const Complex &other) const;
        bool operator>(const double other) const;
        bool operator<=(const Complex &other) const;
        bool operator<=(const double other) const;
        bool operator<(const Complex &other) const;
        bool operator<(const double other) const;

        //friends
        friend ostream &operator<<( ostream &out, const Complex L );
        friend istream &operator>>( istream &out, Complex &L );
        friend Complex operator-( const Complex &other );


    private:
        double real;
        double fake;

        string _getImagPositiveSign() const;
};
#endif
